<%--
  Created by IntelliJ IDEA.
  User: yuzhihao
  Date: 2022/3/15
  Time: 19:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/login.css">
    <link rel="shortcut icon" href="${pageContext.request.contextPath}/image/smallLogo.svg" type="image/x-icon">
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-3.6.0.min.js"></script>

</head>
<body>

<div class="box">
    <div class="left"></div>
    <div class="right">
        <h4>登 录</h4>
<%--        ${pageContext.request.contextPath}/member/login--%>
        <form action="${pageContext.request.contextPath}/member/login" class="login" method="post">
            <input class="telephone" type="text" placeholder="手机号" name="memberTelno">
            <input class="password" type="password" placeholder="密码" name="memberPwd">

            <input class="submit" type="submit" value="登录">
            <br>
            <span style="color: orangered">${login}</span>
            <br>
        </form>
        <div class="fn">
            <a href="${pageContext.request.contextPath}/customer/regist.jsp">注册账号</a>
            <a href="javascript:;">找回密码</a>
        </div>
    </div>
</div>


<script type="text/javascript" src="${pageContext.request.contextPath}/js/crypto-js/crypto-js.js"></script>
<script>

   $(".submit").click(function () {
       const KEY = CryptoJS.enc.Utf8.parse("1234567890123456");
       const IV = CryptoJS.enc.Utf8.parse('1234567890123456');
       let key = KEY
       let iv = IV

       var pwd = $(".password").val();
       let pwdEncode = CryptoJS.enc.Utf8.parse(pwd);
       var encryptedPassword = CryptoJS.AES.encrypt(pwdEncode, key, {
           iv: iv,
           mode: CryptoJS.mode.CBC,
           padding: CryptoJS.pad.ZeroPadding
       })

       var encryptPasswordBase64 =  CryptoJS.enc.Base64.stringify(encryptedPassword.ciphertext);
       $(".password").val(encryptPasswordBase64);

   })

</script>
<script src="${pageContext.request.contextPath}/js/login.js"></script>
</body>
</html>
